package org.chl.chapter05.logic;

import java.util.List;

import org.chl.chapter05.mapper1.BookMapper;
import org.chl.chapter05.mapper2.BookMapper2;
import org.chl.chapter05.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BookLogic {
	@Autowired
	BookMapper bookMapper;
	
	@Autowired
	BookMapper2 bookMapper2;

	public int addBook(Book book) {
		return bookMapper.addBook(book);
	}

	public int updateBook(Book book) {
		return bookMapper.updateBookById(book);
	}

	public int deleteBookById(Integer id) {
		return bookMapper.deleteBookById(id);
	}

	public Book getBookById(Integer id) {
		return bookMapper2.getBookById(id);
	}

	public List<Book> getAllBooks() {
		return bookMapper2.getAllBooks();
	}

}
